<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>14-将伪数组转换为真正的数组</title>
</head>
<body>
    <ul>
        <li>百度</li>
        <li>新浪</li>
        <li>阿里</li>
        <li></li>
        <li>抖音</li>
        <li>腾讯</li>
    </ul>
    <script>
        //伪数组 NodeList HTMLCollection...
        var lis = document.querySelector('ul').querySelectorAll('li');
        console.log(lis);
        //NodeList(5) [ li, li, li, li, li ]
        //var test = ['<li>百度1</li>','<li>百度2</li>','<li>百度3</li>','<li>百度4</li>'];
        //console.log(test);
        var lisArr = [...lis];
        console.log(lisArr);
        //把没有文本的节点去掉
        // var newList = lisArr.filter(function(val){
        //     return val.innerHTML!='';
        // });
        var newList = lisArr.filter((val)=>{
            return val.innerHTML!='';
        });
        console.log(newList);
    </script>
</body>
</html>